package global

import (
	"strings"
)

type CommandStr string

func (c *CommandStr) FillWith(param map[string]string) string {
	for k, v := range param {
		*c = CommandStr(strings.Replace(string(*c), k, v, -1))
	}
	return string(*c)
}

type CompileConfig struct {
	SrcName string // source code file name
	ExeName string // executable file name (after compile)
	// compile will run in the judger sandbox with configs below.
	MaxCpuTime      int
	MaxRealTime     int
	MaxMemory       int
	SecCompRuleName string //c_cpp,c_cpp_file_io,general,golang,node
	// run the command to compile the code.
	CompileCommand CommandStr
}

type RunConfig struct {
	Command     CommandStr
	SeccompRule string
	Env         []string
}

type LanguageCompileConfig struct {
	CompileConfig
	RunConfig
}
